package config

import (
	"log"

	"github.com/minio/minio-go/v7"
	"github.com/minio/minio-go/v7/pkg/credentials"
)

var MinioClient *minio.Client

func init() {
	createClient()
}
func createClient() *minio.Client {
	useSSL := false
	// Initialize minio client object.
	minioClient, err := minio.New(MinioEndpoint, &minio.Options{
		Creds:           credentials.NewStaticV4(MinioAccessKeyID, MinioSecretAccessKey, ""),
		Secure:          useSSL,
		Region:          "",
		BucketLookup:    0,
		TrailingHeaders: false,
		MaxRetries:      0,
	})
	if err != nil {
		log.Fatalln(err)
	}

	MinioClient = minioClient

	return minioClient
}
